package ch.netcetera.planningpoker.server.model;

import java.util.Comparator;

/**
 * Sorts by creation time, the youngest will come
 * first;
 *
 */
public class RoundAgeComparator implements Comparator<Round> {

    @Override
    public int compare(Round o1, Round o2) {
        if (o1 == null) {
            return Integer.MAX_VALUE;
        }
        if (o2 == null) {
            return Integer.MIN_VALUE;
        }
        return o2.getCreatedDate().compareTo(o1.getCreatedDate());
    }

}
